package com.tc.zigbee.zcl;

import com.tc.util.DataUtil;
import com.tc.zigbee.zcl.command.DataValue;

public class ReporterConfigurationRecord {
	public int fill(byte[] data, int offset) {
		int i = offset;
		data[i++] = direction;
		i += DataUtil.bytesValue(attribute, data, i);
		data[i++] = datatype;
		i += DataUtil.bytesValue(minInterval, data, i);
		i += DataUtil.bytesValue(maxInterval, data, i);

		for (int x = 0; x < reportableChange.value.length; x++) {
			data[i++] = reportableChange.value[x++];
		}
		return i - offset;
	}

	public byte[] data() {
		byte[] data = new byte[length()];
		fill(data, 0);
		return data;
	}

	public int length() {
		return 8 + reportableChange.value.length;
	}

	public byte direction = 0;
	public short attribute;
	public byte datatype;
	public short minInterval;
	public short maxInterval;
	public DataValue reportableChange;

}